Conventionally, existing techniques related to the present invention are reverse-compiler (sometimes termed “decompiler”) and instruction-set simulator. Reverse-compiler is a technique to convert a binary executable program (machine instructions), directly executed by a computer, into a source program, which a programmer writes. That is, a reverse-compiler performs the opposite conversion of a compiler which converts a source program into a binary executable program.
Development of reverse-compiler techniques began in the 1960's, where their initial use was to facilitate the conversion (porting) of programs designed for a certain platform into programs that can operate on different platforms. Thereafter, reverse-compiler techniques have been applied to restoring source programs that are accidently lost, debugging programs, detecting and analyzing virus programs, analyzing and understanding program contents, and extracting high level processing structure of the whole program.
On the other hand, instruction-set simulator is a software tool that emulates the behavior of a processor and executes the binary executable program. The objective of on instruction-set simulator is different from that of a reverse-compiler, where the objective of a reverse-compiler is the restoration of highly-readable source programs. For an instruction-set simulator, there exists three schemes, that is, interpreter scheme, static compile scheme and dynamic compile scheme as described below.
Three schemes of instruction-set simulator are described in the followings. Hereinafter, the term “host-CPU” refers to the CPU which executes the instruction-set simulator software. Interpreter scheme (Non-patent Document 3): Each machine code of the binary executable program is decoded (interpreted) one by one to emulate the CPU behavior. Simulation speed is low due the overhead of the decoding process.
Static compile scheme (Non-patent Documents 4, 5, 8, 9, 10): The entire binary executable program is altogether decoded and converted to the host-CPU's machine code instructions, and then the converted machine code instructions are executed at the host-CPU. Also, during the process of converting to the host-CPU's machine instructions, there are cases where the binary executable program is first converted into a source program such as a C program.
Dynamic compile scheme (Non-patent Documents 6, 7): As an improvement of the interpreter scheme, (instead of decoding and executing each machine instruction one by one), a sequence of (a group of) decoded host-CPU's machine instructions are first stored in the host-CPU's memory, and then these machine instructions are directly executed from the memory. This scheme avoids the overhead of repeatedly decoding the same set of instructions by storing the decoded results in the host-CPU's memory. This scheme is also called the “binary translation” from the target-CPU's machine instructions to the host-CPU's machine instructions, and requires implementing a complete instruction-set translation mechanisms that are very complex.